package com.ds.lens.data.common.constant;

import lombok.Getter;

/**
 * describe:
 *
 * @author wangyiming
 * @date 2019/05/16
 */
public enum AggregatorEnum {
    COUNT(0),

    MIN(1),
    MAX(2),
    AVG(3),
    SUM(4),

    P50(5),
    P90(6),
    P95(7),
    P99(8);

    @Getter
    private int value;

    AggregatorEnum(int value) {
        this.value = value;
    }

    public static AggregatorEnum valueOf(Integer value) {
        if (value == null) {
            return null;
        }
        for (AggregatorEnum aggrEnum : AggregatorEnum.values()) {
            if (aggrEnum.value == value) {
                return aggrEnum;
            }
        }
        return null;
    }
}
